
# import yagmail,logging

# def log_set():
#     logging.basicConfig(filename='./log/kongfzlog.txt',level=logging.DEBUG,filemode='w+',format='%(asctime)s-> %(levelname)s-> %(message)s')
#
# def send_mail(filepath):
#     mail = yagmail.SMTP(user='3080172040@qq.com',password='ceswygiwtqzcdfhd',host='smtp.qq.com')
#     mail.send(to='3080172040@qq.com',subject='测试报告',contents="今日报告，请查看",attachments=filepath)

import json

def read_data_json(filepath):
    with open(filepath,'r',encoding='utf-8') as f:
        data = json.load(f)

    print(data)
    return data

# a = read_data_json('../data/data.json')
# print(a)

import pymysql


class DataHandle():

    def __init__(self,):
        #数据库链接
        self.con = pymysql.connect(host='127.0.0.1',user='root',password='123456',database='2212a',charset='utf8')
        #生成一个游标
        self.cur = self.con.cursor()


    def getdatafeomdatabase(self):

        self.cur.execute('select content, casename ,expect from casedata')
        return self.cur.fetchall()

    def close(self):
        #先关闭游标
        self.cur.close()
        #在关闭数据库连接
        self.con.close()


# d = DataHandle()
# print(d.getdatafeomdatabase())
# d.close()

